package com.twentyOne.ClothingLand.service.impl;

import java.util.List;

import com.twentyOne.ClothingLand.dao.IAccountBookDAO;
import com.twentyOne.ClothingLand.dao.impl.AccountBookDAO;
import com.twentyOne.ClothingLand.service.IAccountBookService;
import com.twentyOne.ClothingLand.vo.AccountBook;

public class AccountBookService implements IAccountBookService {
	
	private IAccountBookDAO accountBookDAO = new AccountBookDAO();

	@Override
	public void addAccountBook(AccountBook accountBook) {
		
		this.accountBookDAO.addAccountBook(accountBook);
		
	}

	@Override
	public AccountBook searchAccountBookByInfo(int shopId, int type, int currency) {
		
		return this.accountBookDAO.searchAccountBookByInfo(shopId, type, currency);
		
	}

	@Override
	public void income(AccountBook accountBook, Double amount) {
		
		accountBook.setAccount(accountBook.getAccount() + amount);
		this.accountBookDAO.modifiAccount(accountBook);
		
	}

	@Override
	public void expend(AccountBook accountBook, Double amount) {
		
		accountBook.setAccount(accountBook.getAccount() - amount);
		this.accountBookDAO.modifiAccount(accountBook);
		
	}

	@Override
	public List<AccountBook> searchAccountBookByShopId(int shopId) {
		
		return this.accountBookDAO.searchAccountBookByShopId(shopId);
		
	}

}
